﻿@{
    ViewBag.Title = "报废设备表";
}
@using FMS.UI.Extension;
@section headSecion{
    <script type="text/javascript">

    $(function () {

        $.globalHelper.datagridPara.init("/Factory/FactoryScrap/FactoryScrapIndex", [@Html.GetSonBtnJs()], [
            [
                { field: 'factory_bar_code', title: '统一编号', width: 20 },
                { field: 'factory_Machines_Name', title: '设备名称', width: 20 },
                {
                    field: 'factory_Machines_Kind_Type_Id',
                    title: '设备大类',
                    width: 20,
                    formatter: function (colData) {
                        switch (colData) {
                            case 1:
                                return "动力设备";
                            case 2:
                                return "机械设备";
                            case 3:
                                return "工程车辆";
                        }
                    }
                },
                 {
                     field: 'Factory_Machines_Kind1',
                     title: '二级分类',
                     width: 20,
                     formatter: function (colData) {
                         return colData.k1name;
                     }
                 },
                   {
                       field: 'Factory_Machines_Kind2',
                       title: '三级分类',
                       width: 20,
                       formatter: function (colData) {
                           return colData.k2name;
                       }
                   },
                {
                    field: 'Factory_Machines_Kind',
                    title: '设备类型',
                    width: 20,
                    formatter: function (colData) {
                        return colData.factory_Machines_Kind_Name;
                    }
                },
                { field: 'factory_Machines_Type', title: '设备型号', width: 20 },
                { field: 'factory_Machines_Size', title: '标准规格', width: 20 },
                {
                    field: 'Factory_Machines_Supplier',
                    title: '供应商',
                    width: 20,
                    formatter: function (colData) { return colData.supplier_Name; }
                },
                { field: 'factory_Machines_KW', title: '功率KW', width: 20 },
                {
                    field: 'factory_Machines_OutDate',
                    title: '出厂日期',
                    width: 20,
                    formatter: function (colData) {
                        return $.globalHelper.changeTimeFormat(colData);
                    }
                },
                {
                    field: 'factory_Machines_InDate',
                    title: '入厂日期',
                    width: 20,
                    formatter: function (colData) {
                        return $.globalHelper.changeTimeFormat(colData);
                    }
                },
                {
                    field: 'factory_Machines_UseDate',
                    title: '投产日期',
                    width: 20,
                    formatter: function (colData) {
                        return $.globalHelper.changeTimeFormat(colData);
                    }
                },
                { field: 'factory_Machines_Price', title: '金额', width: 20 },
                { field: 'factory_depreciation', title: '已提折旧', width: 20 },
                { field: 'factory_networth', title: '净值', width: 20 },
                {
                    field: 'Department',
                    title: '使用单位',
                    width: 20,
                    formatter: function (colData) {
                        return colData.depName;
                    }
                },
               {
                   field: 'Company',
                   title: '公司名称',
                   width: 20,
                   formatter: function (colData) {
                       return colData.compName;
                   }
               },
                { field: 'factory_Machines_installation_site', title: '安装地点', width: 20 },
                {
                    field: 'Factory_Machines_EquipmentStatus',
                    title: '性能状态',
                    width: 20,
                    formatter: function (colData) {
                        return colData.EName;
                    }
                },
                {
                    field: 'Factory_Machines_UseState',
                    title: '使用状态',
                    width: 20,
                    formatter: function (colData) {
                        return colData.UName;
                    }
                },
                { field: 'factory_Machines_UserId', title: '操作者', width: 20 },
                {
                    field: 'Factory_Machines_Type1',
                    title: '分类',
                    width: 10,
                    formatter: function (colData) {
                        return colData.factory_Machines_Type_Name;
                    }
                }
            ]
        ]);
        $("#tbList").datagrid($.globalHelper.datagridPara.paras);
        //$("#tbList").datagrid('enableFilter');不分页可以用这个搜索
        //$("#tbList").datagrid('hideColumn', 'factory_Machines_InDate');
    });
    @if (Html.IsBtnExist("show"))
         {
       <text>
    function show() {

    }
    </text>
        }

    @if (Html.IsBtnExist("add"))
        {
            <text>

    function add() {
        $.globalHelper.showCommonWindow("新增设备信息", "/Factory/FactoryMachines/FactoryMachinesAdd", 630, 508);
    }
    </text>
        }

    @if (Html.IsBtnExist("remove"))
        {
            <text>

    function remove() {
        ifSelected(function (selectedRowData) {
            window.top.ComSkipMsg(selectedRowData, "/Factory/FactoryMachines/FactoryMachinesDel");
        });
    }
    </text>
        }

    @if (Html.IsBtnExist("search"))
        {
            <text>
    function search() //查询条件
    {

        $.globalHelper.showCommonWindow("报废信息查询", "/Factory/FactoryScrap/FactoryScrapSearch", 630, 330);
    }
    </text>
        }
    @if (Html.IsBtnExist("viewSons"))
         {
             <text>
    function viewSons() //查询条件
    {
        $.globalHelper.showCommonWindow("列设置", "/Factory/FactoryMachines/FactoryMachinesSet", 220, 265);


    }
    </text>
         }

    @if (Html.IsBtnExist("modify"))
        {
            <text>
    function modify() {

        ifSelected(function (selectedRowData) {
            $.globalHelper.showCommonWindow("修改设备管理角色权限", "/Factory/FactoryMachines/FactoryMachinesModify/" + selectedRowData.factory_Machines_Id, 630, 508);
        });
    }
    </text>
        }

    //统一判断是否有选中行 有则调用回掉函数(func) 并存入选中行的数据
    function ifSelected(func) {
        //获取选中行数据
        var selectedRowData = $("#tbList").datagrid("getSelected");
        if (selectedRowData) {
            if (func && func instanceof Function) {
                func(selectedRowData);
            }


        } else {
            $.msgBoxObj.showInfo("请选中要操作的行");
        }
    }

    </script>
}

<table id="tbList" style="width:100%"></table>

